home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Source Code / Libraries / C Internet Config / IC Application Source ƒ / C Source ƒ / IC Edit Pref AppleEvents.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-12-01  |  1001 b   |  46 lines  |  [TEXT/SPM ]

  1. /*
  2.     IC Edit Pref AppleEvents.c
  3.     
  4. */
  5.  
  6. #include <AppleEvents.h>
  7.  
  8. #include "IC Globals.h"
  9. #include "IC Document.h"
  10. #include "IC Edit Pref AppleEvents.h"
  11.  
  12. #include "IC Window Globals.h"
  13.  
  14. pascal OSErr HandleEditPrefAE(AppleEvent* event,AppleEvent* reply,long ignored){
  15.     Str255 key;
  16.     DescType typ;
  17.     Size actualSize;
  18.     FSSpec fs;
  19.     Boolean usefss=true,usecurrent=false;
  20.     OSErr err;
  21.     
  22.     err=AEGetParamPtr(event,EPDestination,typeFSS,&typ,&fs,sizeof(FSSpec),&actualSize);
  23.     if (err!=noErr){
  24.         usefss=false;
  25.         usecurrent=true;
  26.         
  27.         if (AEGetParamPtr(event,EPDestination,typeBoolean,&typ,&fs,sizeof(FSSpec),&actualSize)==noErr)
  28.             usecurrent=false;
  29.     }
  30.     
  31.     err=AEGetParamPtr(event,keyDirectObject,typeChar,&typ,&key[1],255,&actualSize);
  32.     if (err!=noErr)
  33.         actualSize=0;
  34.     
  35.     key[0]=(unsigned char)(actualSize&0x000000ff);
  36.     
  37.     err=EditPreference(key,&fs,usefss,usecurrent);
  38.     return err;
  39. }
  40.  
  41. void SetupEditPrefAppleEvent(void){
  42.     if (Has_AppleEvents){
  43.         AEInstallEventHandler(EPSuite,EPEvent,gHandleEditPrefAE,0,false);
  44.     }
  45. }
  46.